const playerAction = process.argv[2];
if (playerAction !== 'rock' && playerAction !== 'paper' && playerAction !== 'scissors') {
    console.log('请输入 rock/paper/scissors ');

} else {
    const arr = ['rock', 'paper', 'scissors']
    const index = Math.floor(Math.random() * 3) // Math.random() 0-1的随机取值
    const computerAction = arr[index]
    console.log('你出的是' + playerAction);
    console.log('电脑出是', computerAction);
}

if (playerAction === computerAction) {
    console.log('平局');
} else if (
    (playerAction === 'rock' && computerAction === 'paper') ||
    (playerAction === 'paper' && computerAction === 'scissors') ||
    (playerAction === 'scissors' && computerAction === 'rock')
) {
    console.log('你输了');
} else {
    console.log('你赢了');
}